* Wealth index calculation. Guillermo Rojas, 04/29/2016. Colombia DHS 2015. cd 'C:\CO71\Wealth'. set unicode=no. include file='C:\CO71\Wealth\wealth_assets.sps'. execute. set tvars=both. * Macro definitions to perform some recoding automatically. * Note: Do not use an asterisk in front of a macro name to try to comment it out - it will run any way because of the way the macros are expanded. * Delete the line instead or change the spelling of the macro in the comment. * Do not use the names of macros in comments - they will also be expanded too, and likely will fail. *{Create binary variables based on condition and give label }. define dichotomize( !positional !enclose('(',')') / !positional !tokens(1) / !positional !tokens(1) ) compute !2=0. if (!1) !2=1. variable labels !2 !3. value labels !2 0 'No' 1 'Yes'. formats !2 (f1.0). !enddefine. *(Separate shared toilets from non-shared toilets). define shared_fac( !positional !tokens(1) / !positional !tokens(1) / !positional !tokens(1) ). compute !2 = 0. do if (QH75=1). + if (!1=1) !2 = 1. + compute !1 = 0. end if. variable labels !2 !3. value labels !2 0 'No' 1 'Yes'. formats !2 (f1.0). !enddefine. *{Reset missing values to 'does not have', change 2 code to 0}. define no2zero( !positional !tokens(1) ) if (missing(!1) | !1<>1) !1=0. value labels !1 0 'No' 1 'Yes'. !enddefine. *{Construct Variables}. * Energía eléctrica. no2zero QH68A. * Vivienda tiene gas natural. no2zero QH68B. * Vivienda tiene acueducto. no2zero QH68C. * Vivienda tiene alcantarillado. no2zero QH68D. * Vivienda tiene recolección de basuras. no2zero QH68E. * Fuente de agua para beber. dichotomize (QH72=11) QH72_11 "Fuente de agua para beber: Acueducto público". dichotomize (QH72=12) QH72_12 "Fuente de agua para beber: Acueducto comunal o veredal". dichotomize (QH72=21) QH72_21 "Fuente de agua para beber: Pila pública". dichotomize (QH72=22) QH72_22 "Fuente de agua para beber: Pozo con bomba". dichotomize (QH72=23) QH72_23 "Fuente de agua para beber: Pozo sin bomba, jaguey". dichotomize (QH72=31) QH72_31 "Fuente de agua para beber: Río, quebrada, manantial, nacimiento". dichotomize (QH72=41) QH72_41 "Fuente de agua para beber: Carrotanque". dichotomize (QH72=42) QH72_42 "Fuente de agua para beber: Aguatero". dichotomize (QH72=43) QH72_43 "Fuente de agua para beber: Agua embotellada o en bolsa". dichotomize (QH72=51) QH72_51 "Fuente de agua para beber: Agua lluvia". dichotomize (QH72=96) QH72_96 "Fuente de agua para beber: Otro". * Tipo de servicio sanitario. dichotomize (QH73=11) QH73_11 "Tipo de servicio sanitario: Inodoro conectado al alcantarillado". dichotomize (QH73=12) QH73_12 "Tipo de servicio sanitario: Inodoro conectado al pozo séptico". dichotomize (QH73=13) QH73_13 "Tipo de servicio sanitario: Inodoro sin conexión". dichotomize (QH73=21) QH73_21 "Tipo de servicio sanitario: Letrina (pozo negro, hoyo)". dichotomize (QH73=22) QH73_22 "Tipo de servicio sanitario: Bajamar". dichotomize (QH73=96) QH73_96 "Tipo de servicio sanitario: Otro". dichotomize (QH73=31) QH73_31 "Tipo de servicio sanitario: No tiene sanitario". shared_fac QH73_11 QH73_11_sh "Tipo de servicio sanitario: Inodoro conectado al alcantarillado - shared". shared_fac QH73_12 QH73_12_sh "Tipo de servicio sanitario: Inodoro conectado al pozo séptico - shared". shared_fac QH73_13 QH73_13_sh "Tipo de servicio sanitario: Inodoro sin conexión - shared". shared_fac QH73_21 QH73_21_sh "Tipo de servicio sanitario: Letrina (pozo negro, hoyo) - shared". shared_fac QH73_22 QH73_22_sh "Tipo de servicio sanitario: Bajamar - shared". shared_fac QH73_96 QH73_96_sh "Tipo de servicio sanitario: Otro - shared". shared_fac QH73_31 QH73_31_sh "Tipo de servicio sanitario: No tiene sanitario - shared". * Ubicación del sanitario. dichotomize (QH76=1) QH76_1 "Ubicación del sanitario: Dentro de la vivienda". dichotomize (QH76=2) QH76_2 "Ubicación del sanitario: Fuera de la vivienda, pero en el lote o terreno". dichotomize (QH76=6) QH76_6 "Ubicación del sanitario: Otro". * Ducha o regadera. no2zero QH77. * Combustible usado para cocinar. dichotomize (QH78=1) QH78_1 "Combustible usado para cocinar: Gas natural conectado a red pública". dichotomize (QH78=2) QH78_2 "Combustible usado para cocinar: Gas propano (cilindro/pipeta)". dichotomize (QH78=3) QH78_3 "Combustible usado para cocinar: Kerosene, petróleo, cocinol, ACPM, gasolina, alcohol". dichotomize (QH78=4) QH78_4 "Combustible usado para cocinar: Energía eléctrica". dichotomize (QH78=5) QH78_5 "Combustible usado para cocinar: Leña, madera, carbón de leña". dichotomize (QH78=6) QH78_6 "Combustible usado para cocinar: Carbón mineral". dichotomize (QH78=7) QH78_7 "Combustible usado para cocinar: Material de desecho". dichotomize (QH78=88) QH78_88 "Combustible usado para cocinar: No cocina". dichotomize (QH78=96) QH78_96 "Combustible usado para cocinar: Otro". * Teléfono fijo. no2zero QH79A. * Teléfono celular. no2zero QH79B. * Radio. no2zero QH79C. * Televisión. no2zero QH79D. * Nevera. no2zero QH79E. * Lavadora. no2zero QH79F. * Horno microondas. no2zero QH79G. * Moto. no2zero QH79H. * Carro. no2zero QH79I. * Bicicleta. no2zero QH79J. * Computador. no2zero QH79K. * Internet. no2zero QH79L. * Uso de servicio telefónico. no2zero QH80. * Principal forma de eliminación de basuras. dichotomize (QH81=1) QH81_1 "Principal forma de eliminación de basuras: La recoge el servicio de aseo". dichotomize (QH81=2) QH81_2 "Principal forma de eliminación de basuras: La queman". dichotomize (QH81=3) QH81_3 "Principal forma de eliminación de basuras: La entierran". dichotomize (QH81=4) QH81_4 "Principal forma de eliminación de basuras: La botan al río, caño, laguna, quebrada". dichotomize (QH81=5) QH81_5 "Principal forma de eliminación de basuras: La botan al patio, lote, zanja, baldío". dichotomize (QH81=6) QH81_6 "Principal forma de eliminación de basuras: La recoge un servicio informal (carreta, zorra)". dichotomize (QH81=96) QH81_96 "Principal forma de eliminación de basuras: Otro". * Principal material del piso. dichotomize (QH83=1) QH83_1 "Principal material del piso: Alfombra o tapete de pared a pared". dichotomize (QH83=2) QH83_2 "Principal material del piso: Madera pulida y lacada, parqué". dichotomize (QH83=3) QH83_3 "Principal material del piso: Marmol". dichotomize (QH83=4) QH83_4 "Principal material del piso: Baldosa, vinilo, tableta, ladrillo". dichotomize (QH83=5) QH83_5 "Principal material del piso: Madera burda, tabla, tablón, otro material vegetal". dichotomize (QH83=6) QH83_6 "Principal material del piso: Cemento, gravilla". dichotomize (QH83=7) QH83_7 "Principal material del piso: Tierra, arena". dichotomize (QH83=96) QH83_96 "Principal material del piso: Otro". * Principal material de las paredes. dichotomize (QH84=1) QH84_1 "Principal material de las paredes: Tapia pisada, adobe". dichotomize (QH84=2) QH84_2 "Principal material de las paredes: Bahareque revocado". dichotomize (QH84=3) QH84_3 "Principal material de las paredes: Bahareque sin revocar". dichotomize (QH84=4) QH84_4 "Principal material de las paredes: Madera burda, tabla, tablón". dichotomize (QH84=5) QH84_5 "Principal material de las paredes: Guadua, caña, esterilla, otro vegetal". dichotomize (QH84=6) QH84_6 "Principal material de las paredes: Bloque, ladrillo, piedra, madera pulida". dichotomize (QH84=7) QH84_7 "Principal material de las paredes: Material prefabricado". dichotomize (QH84=8) QH84_8 "Principal material de las paredes: Zinc, tela, lona, cartón, latas, plásticos, deshechos". dichotomize (QH84=9) QH84_9 "Principal material de las paredes: Sin paredes". dichotomize (QH84=96) QH84_96 "Principal material de las paredes: Otro". * Tipo de vivienda. dichotomize (QH85=1) QH85_1 "Tipo de vivienda: Casa". dichotomize (QH85=2) QH85_2 "Tipo de vivienda: Apartamento". dichotomize (QH85=3) QH85_3 "Tipo de vivienda: Cuarto en inquilinato". dichotomize (QH85=4) QH85_4 "Tipo de vivienda: Cuarto en otro tipo de estructura". dichotomize (QH85=5) QH85_5 "Tipo de vivienda: Vivienda indígena". dichotomize (QH85=6) QH85_6 "Tipo de vivienda: Otro (carpa, tienda, vagón, refugio natural, embarcación puente)". * Tenencia de la vivienda. dichotomize (QH86=1) QH86_1 "Tenencia de la vivienda: Propia totalmente pagada". dichotomize (QH86=2) QH86_2 "Tenencia de la vivienda: Propia la están pagando". dichotomize (QH86=3) QH86_3 "Tenencia de la vivienda: En arriendo o subarriendo". dichotomize (QH86=4) QH86_4 "Tenencia de la vivienda: En usufructo". dichotomize (QH86=5) QH86_5 "Tenencia de la vivienda: Posesión sin título (ocupante de hecho)". dichotomize (QH86=6) QH86_6 "Tenencia de la vivienda: Vivienda en empeño". dichotomize (QH86=7) QH86_7 "Tenencia de la vivienda: Propiedad colectiva". dichotomize (QH86=96) QH86_96 "Tenencia de la vivienda: Otra". *{Members per sleeping room}. if (hhusual=0) hhusual=hhslept. if (QH82>0) memsleep=trunc(hhusual/QH82). if (QH82=0) memsleep=hhusual. if (missing(QH82) or QH82>=99 or memsleep>=98) memsleep=99. variable labels memsleep 'Number of members per sleeping room'. value labels memsleep 0 'Less than 1 per room'. formats memsleep (f2.0). missing values memsleep (99). * Compute urban and rural variables coded (1/0) for filters later. compute urban=(QHTYPE = 1). compute rural=(QHTYPE = 2). variable labels urban 'Urban' / rural 'Rural'. value labels urban 1 'Urban' / rural 1 'Rural'. formats urban rural (f1.0). execute. * Check on indicator variable creation. frequencies variables=QHTYPE to domestic. * Toilet facility by shared/not shared. crosstabs /tables=QH73 by QH75. * Land area by units - if there are separate units - need to convert them to one unit. *crosstabs /tables=ZH120N by ZH120U. frequencies variables= QH68A QH68B QH68C QH68D QH68E QH72_11 QH72_12 QH72_21 QH72_22 QH72_23 QH72_31 QH72_41 QH72_42 QH72_43 QH72_51 QH72_96 QH73_11 QH73_12 QH73_13 QH73_21 QH73_22 QH73_96 QH73_31 QH73_11_sh QH73_12_sh QH73_13_sh QH73_21_sh QH73_22_sh QH73_96_sh QH74 QH76_1 QH76_2 QH76_6 QH77 QH78_1 QH78_2 QH78_3 QH78_4 QH78_5 QH78_6 QH78_88 QH78_96 QH79A QH79B QH79C QH79D QH79E QH79F QH79G QH79H QH79I QH79J QH79K QH79L QH80 QH81_1 QH81_2 QH81_3 QH81_4 QH81_5 QH81_6 QH81_96 QH83_1 QH83_2 QH83_3 QH83_4 QH83_5 QH83_6 QH83_7 QH83_96 QH84_1 QH84_2 QH84_3 QH84_4 QH84_5 QH84_6 QH84_7 QH84_8 QH84_9 QH84_96 QH85_1 QH85_2 QH85_3 QH85_4 QH85_5 QH85_6 QH86_1 QH86_2 QH86_3 QH86_4 QH86_5 QH86_6 QH86_7 QH86_96 DOMESTIC LAND HOUSE1 HOUSE2 JEWLERY ANIMALS memsleep . * Turn off weights before all factor analysis. weight off. * Name the dataset window for the HH data for use later. dataset name assets. save outfile='assets.sav'. *** Test Factor Analysis. filter off. execute. factor /variables QH68A QH68B QH68C QH68D QH68E QH72_11 QH72_12 QH72_21 QH72_22 QH72_23 QH72_31 QH72_41 QH72_42 QH72_43 QH72_51 QH72_96 QH73_11 QH73_12 QH73_13 QH73_21 QH73_22 QH73_96 QH73_31 QH73_11_sh QH73_12_sh QH73_13_sh QH73_21_sh QH73_22_sh QH73_96_sh QH74 QH76_1 QH76_2 QH76_6 QH77 QH78_1 QH78_2 QH78_3 QH78_4 QH78_5 QH78_6 QH78_88 QH78_96 QH79A QH79B QH79C QH79D QH79E QH79F QH79G QH79H QH79I QH79J QH79K QH79L QH80 QH81_1 QH81_2 QH81_3 QH81_4 QH81_5 QH81_6 QH81_96 QH83_1 QH83_2 QH83_3 QH83_4 QH83_5 QH83_6 QH83_7 QH83_96 QH84_1 QH84_2 QH84_3 QH84_4 QH84_5 QH84_6 QH84_7 QH84_8 QH84_9 QH84_96 QH85_1 QH85_2 QH85_3 QH85_4 QH85_5 QH85_6 QH86_1 QH86_2 QH86_3 QH86_4 QH86_5 QH86_6 QH86_7 QH86_96 DOMESTIC LAND HOUSE1 HOUSE2 JEWLERY ANIMALS memsleep /missing meansub /analysis QH68A QH68B QH68C QH68D QH68E QH72_11 QH72_12 QH72_21 QH72_22 QH72_23 QH72_31 QH72_41 QH72_42 QH72_43 QH72_51 QH72_96 QH73_11 QH73_12 QH73_13 QH73_21 QH73_22 QH73_96 QH73_31 QH73_11_sh QH73_12_sh QH73_13_sh QH73_21_sh QH73_22_sh QH73_96_sh QH74 QH76_1 QH76_2 QH76_6 QH77 QH78_1 QH78_2 QH78_3 QH78_4 QH78_5 QH78_6 QH78_88 QH78_96 QH79A QH79B QH79C QH79D QH79E QH79F QH79G QH79H QH79I QH79J QH79K QH79L QH80 QH81_1 QH81_2 QH81_3 QH81_4 QH81_5 QH81_6 QH81_96 QH83_1 QH83_2 QH83_3 QH83_4 QH83_5 QH83_6 QH83_7 QH83_96 QH84_1 QH84_2 QH84_3 QH84_4 QH84_5 QH84_6 QH84_7 QH84_8 QH84_9 QH84_96 QH85_1 QH85_2 QH85_3 QH85_4 QH85_5 QH85_6 QH86_1 QH86_2 QH86_3 QH86_4 QH86_5 QH86_6 QH86_7 QH86_96 DOMESTIC LAND HOUSE1 HOUSE2 JEWLERY ANIMALS memsleep /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /method=correlation. *** Common Factor analysis ***. ** Removed area-specific variables **. ** Agricultural animal variables excluded ** Land area excluded ** Any others ?. *** Common Factor Analysis. filter off. execute. factor /variables QH68A QH68B QH68C QH68D QH68E QH72_11 QH72_12 QH72_21 QH72_22 QH72_23 QH72_31 QH72_41 QH72_42 QH72_43 QH72_51 QH72_96 QH73_11 QH73_12 QH73_13 QH73_21 QH73_22 QH73_96 QH73_31 QH73_11_sh QH73_12_sh QH73_13_sh QH73_21_sh QH73_22_sh QH73_96_sh QH74 QH76_1 QH76_2 QH76_6 QH77 QH78_1 QH78_2 QH78_3 QH78_4 QH78_5 QH78_6 QH78_88 QH78_96 QH79A QH79B QH79C QH79D QH79E QH79F QH79G QH79H QH79I QH79J QH79K QH79L QH80 QH81_1 QH81_2 QH81_3 QH81_4 QH81_5 QH81_6 QH81_96 QH83_1 QH83_2 QH83_3 QH83_4 QH83_5 QH83_6 QH83_7 QH83_96 QH84_1 QH84_2 QH84_3 QH84_4 QH84_5 QH84_6 QH84_7 QH84_8 QH84_9 QH84_96 QH85_1 QH85_2 QH85_3 QH85_4 QH85_5 QH85_6 QH86_1 QH86_2 QH86_3 QH86_4 QH86_5 QH86_6 QH86_7 QH86_96 DOMESTIC LAND HOUSE1 HOUSE2 JEWLERY ANIMALS memsleep /missing meansub /analysis QH68A QH68B QH68C QH68D QH68E QH72_11 QH72_12 QH72_21 QH72_22 QH72_23 QH72_31 QH72_41 QH72_42 QH72_43 QH72_51 QH72_96 QH73_11 QH73_12 QH73_13 QH73_21 QH73_22 QH73_96 QH73_31 QH73_11_sh QH73_12_sh QH73_13_sh QH73_21_sh QH73_22_sh QH73_96_sh QH74 QH76_1 QH76_2 QH76_6 QH77 QH78_1 QH78_2 QH78_3 QH78_4 QH78_5 QH78_6 QH78_88 QH78_96 QH79A QH79B QH79C QH79D QH79E QH79F QH79G QH79H QH79I QH79J QH79K QH79L QH80 QH81_1 QH81_2 QH81_3 QH81_4 QH81_5 QH81_6 QH81_96 QH83_1 QH83_2 QH83_3 QH83_4 QH83_5 QH83_6 QH83_7 QH83_96 QH84_1 QH84_2 QH84_3 QH84_4 QH84_5 QH84_6 QH84_7 QH84_8 QH84_9 QH84_96 QH85_1 QH85_2 QH85_3 QH85_4 QH85_5 QH85_6 QH86_1 QH86_2 QH86_3 QH86_4 QH86_5 QH86_6 QH86_7 QH86_96 DOMESTIC LAND HOUSE1 HOUSE2 JEWLERY ANIMALS memsleep /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL com) /method=correlation. *** Urban Factor Analysis. filter off. filter by urban. execute. factor /variables QH68A QH68B QH68C QH68D QH68E QH72_11 QH72_12 QH72_21 QH72_22 QH72_23 QH72_31 QH72_41 QH72_42 QH72_43 QH72_51 QH72_96 QH73_11 QH73_12 QH73_13 QH73_21 QH73_22 QH73_96 QH73_31 QH73_11_sh QH73_12_sh QH73_13_sh QH73_21_sh QH73_22_sh QH73_96_sh QH74 QH76_1 QH76_2 QH76_6 QH77 QH78_1 QH78_2 QH78_3 QH78_4 QH78_5 QH78_6 QH78_88 QH78_96 QH79A QH79B QH79C QH79D QH79E QH79F QH79G QH79H QH79I QH79J QH79K QH79L QH80 QH81_1 QH81_2 QH81_3 QH81_4 QH81_5 QH81_6 QH81_96 QH83_1 QH83_2 QH83_3 QH83_4 QH83_5 QH83_6 QH83_7 QH83_96 QH84_1 QH84_2 QH84_3 QH84_4 QH84_5 QH84_6 QH84_7 QH84_8 QH84_9 QH84_96 QH85_1 QH85_2 QH85_3 QH85_4 QH85_5 QH85_6 QH86_1 QH86_2 QH86_3 QH86_4 QH86_5 QH86_6 QH86_7 QH86_96 DOMESTIC LAND HOUSE1 HOUSE2 JEWLERY ANIMALS memsleep /missing meansub /analysis QH68A QH68B QH68C QH68D QH68E QH72_11 QH72_12 QH72_21 QH72_22 QH72_23 QH72_31 QH72_41 QH72_42 QH72_43 QH72_51 QH72_96 QH73_11 QH73_12 QH73_13 QH73_21 QH73_22 QH73_96 QH73_31 QH73_11_sh QH73_12_sh QH73_13_sh QH73_21_sh QH73_22_sh QH73_96_sh QH74 QH76_1 QH76_2 QH76_6 QH77 QH78_1 QH78_2 QH78_3 QH78_4 QH78_5 QH78_6 QH78_88 QH78_96 QH79A QH79B QH79C QH79D QH79E QH79F QH79G QH79H QH79I QH79J QH79K QH79L QH80 QH81_1 QH81_2 QH81_3 QH81_4 QH81_5 QH81_6 QH81_96 QH83_1 QH83_2 QH83_3 QH83_4 QH83_5 QH83_6 QH83_7 QH83_96 QH84_1 QH84_2 QH84_3 QH84_4 QH84_5 QH84_6 QH84_7 QH84_8 QH84_9 QH84_96 QH85_1 QH85_2 QH85_3 QH85_4 QH85_5 QH85_6 QH86_1 QH86_2 QH86_3 QH86_4 QH86_5 QH86_6 QH86_7 QH86_96 DOMESTIC LAND HOUSE1 HOUSE2 JEWLERY ANIMALS memsleep /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL urb) /method=correlation. *** Rural Factor Analysis. filter off. filter by rural. execute. factor /variables QH68A QH68B QH68C QH68D QH68E QH72_11 QH72_12 QH72_21 QH72_22 QH72_23 QH72_31 QH72_41 QH72_42 QH72_43 QH72_51 QH72_96 QH73_11 QH73_12 QH73_13 QH73_21 QH73_22 QH73_96 QH73_31 QH73_11_sh QH73_12_sh QH73_13_sh QH73_21_sh QH73_22_sh QH73_96_sh QH74 QH76_1 QH76_2 QH76_6 QH77 QH78_1 QH78_2 QH78_3 QH78_4 QH78_5 QH78_6 QH78_88 QH78_96 QH79A QH79B QH79C QH79D QH79E QH79F QH79G QH79H QH79I QH79J QH79K QH79L QH80 QH81_1 QH81_2 QH81_3 QH81_4 QH81_5 QH81_6 QH81_96 QH83_1 QH83_2 QH83_3 QH83_4 QH83_5 QH83_6 QH83_7 QH83_96 QH84_1 QH84_2 QH84_3 QH84_4 QH84_5 QH84_6 QH84_7 QH84_8 QH84_9 QH84_96 QH85_1 QH85_2 QH85_3 QH85_4 QH85_5 QH85_6 QH86_1 QH86_2 QH86_3 QH86_4 QH86_5 QH86_6 QH86_7 QH86_96 DOMESTIC LAND HOUSE1 HOUSE2 JEWLERY ANIMALS memsleep /missing meansub /analysis QH68A QH68B QH68C QH68D QH68E QH72_11 QH72_12 QH72_21 QH72_22 QH72_23 QH72_31 QH72_41 QH72_42 QH72_43 QH72_51 QH72_96 QH73_11 QH73_12 QH73_13 QH73_21 QH73_22 QH73_96 QH73_31 QH73_11_sh QH73_12_sh QH73_13_sh QH73_21_sh QH73_22_sh QH73_96_sh QH74 QH76_1 QH76_2 QH76_6 QH77 QH78_1 QH78_2 QH78_3 QH78_4 QH78_5 QH78_6 QH78_88 QH78_96 QH79A QH79B QH79C QH79D QH79E QH79F QH79G QH79H QH79I QH79J QH79K QH79L QH80 QH81_1 QH81_2 QH81_3 QH81_4 QH81_5 QH81_6 QH81_96 QH83_1 QH83_2 QH83_3 QH83_4 QH83_5 QH83_6 QH83_7 QH83_96 QH84_1 QH84_2 QH84_3 QH84_4 QH84_5 QH84_6 QH84_7 QH84_8 QH84_9 QH84_96 QH85_1 QH85_2 QH85_3 QH85_4 QH85_5 QH85_6 QH86_1 QH86_2 QH86_3 QH86_4 QH86_5 QH86_6 QH86_7 QH86_96 DOMESTIC LAND HOUSE1 HOUSE2 JEWLERY ANIMALS memsleep /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL rur) /method=correlation. * Label the created score variables. rename variables (com1 urb1 rur1=comscore urbscore rurscore). variable labels comscore 'Common wealth score' /urbscore 'Urban wealth score' /rurscore 'Rural wealth score'. * Add a variable used for linking later. filter off. string rowtype_ (A8). compute rowtype_ = 'EST'. * Calculate regressions. ** Area=urban. filter off. filter by urban. execute. * Declare a dataset to be written to in the regression. dataset declare urbancorv. * Run regression of comscore with urbscore. regression /missing listwise /statistics coeff outs R anova /criteria=pin(.05) pout(.10) /noorigin /dependent comscore /method=enter urbscore /outfile=corv(urbancorv). * Activate file of output from regression. dataset activate urbancorv. * Drop all rows of output except the coefficients. select if (rowtype_ = 'EST'). execute. * Delete unnecessary variables before merging. delete variables DEPVAR_ VARNAME_. * Rename variables containing the constant and the coefficient. rename variables CONST_=urbconst urbscore=urbcoeff. * Re-activate the main household data. dataset activate assets. * merge the coefficients. match files /file = * /table = urbancorv /by ROWTYPE_. execute. * Calculate regressions. ** Area=rural. filter off. filter by rural. execute. * Declare a dataset to be written to in the regression. dataset declare ruralcorv. * Run regression of comscore with rurscore. regression /missing listwise /statistics coeff outs R anova /criteria=pin(.05) pout(.10) /noorigin /dependent comscore /method=enter rurscore /outfile=corv(ruralcorv). * Activate file of output from regression. dataset activate ruralcorv. * Drop all rows of output except the coefficients. select if (rowtype_ = 'EST'). execute. * Delete unnecessary variables before merging. delete variables DEPVAR_ VARNAME_. * Rename variables containing the constant and the coefficient. rename variables CONST_=rurconst rurscore=rurcoeff. * Re-activate the main household data. dataset activate assets. * merge the coefficients. match files /file = * /table = ruralcorv /by ROWTYPE_. execute. dataset close urbancorv. dataset close ruralcorv. dataset activate assets. filter off. *** Calculate combined wealth score from Urban and Rural Scores. * Use coefficients from urban and rural regressions above. compute combscor=0. print formats combscor (f11.5). write formats combscor (f11.5). ** Urban. if (urban = 1) combscor=urbconst+urbcoeff*urbscore. ** Rural. if (rural = 1) combscor=rurconst+rurcoeff*rurscore. variable labels combscor 'Combined national wealth score'. execute. compute hhwt = QHWEIGHT/1000000. variable labels hhwt 'HH weights'. weight by hhwt. filter off. execute. frequencies variables=combscor comscore /format=notable /ntiles=5 /statistics=stddev mean /histogram normal /order=analysis. filter off. filter by urban. execute. frequencies variables=combscor urbscore /format=notable /ntiles=5 /statistics=stddev mean /histogram normal /order=analysis. filter off. filter by rural. execute. frequencies variables=combscor rurscore /format=notable /ntiles=5 /statistics=stddev mean /histogram normal /order=analysis. filter off. execute. *Calculate quintiles and scores for data file. compute hhmemwt=QHWEIGHT*hhusual/1000000. weight by hhmemwt. variable labels hhmemwt 'HH members weighting for index'. filter off. filter by urban. execute. rank variables=urbscore (A) /rank /ntiles (5) /print=yes /ties=mean. filter off. filter by rural. execute. rank variables=rurscore (A) /rank /ntiles (5) /print=yes /ties=mean. filter off. execute. rank variables=combscor (A) /rank /ntiles (5) /print=yes /ties=mean. variable labels ncombsco 'Combined wealth index' /nurbscor 'Urban wealth index' /nrurscor 'Rural wealth index'. value labels ncombsco nurbscor nrurscor 1 'Lowest' 2 'Second' 3 'Middle' 4 'Fourth' 5 'Highest'. *** Check on quintiles. frequencies variables=ncombsco nurbscor nrurscor. weight by hhwt. ctables /table ( QH68A+QH68B+QH68C+QH68D+QH68E+ QH72_11+QH72_12+QH72_21+QH72_22+QH72_23+QH72_31+QH72_41+QH72_42+QH72_43+QH72_51+QH72_96+ QH73_11+QH73_12+QH73_13+QH73_21+QH73_22+QH73_96+QH73_31+ QH73_11_sh+QH73_12_sh+QH73_13_sh+QH73_21_sh+QH73_22_sh+QH73_96_sh+ QH74+QH76_1+QH76_2+QH76_6+QH77+ QH78_1+QH78_2+QH78_3+QH78_4+QH78_5+QH78_6+QH78_88+QH78_96+ QH79A+QH79B+QH79C+QH79D+QH79E+QH79F+QH79G+QH79H+QH79I+QH79J+QH79K+QH79L+QH80+ QH81_1+QH81_2+QH81_3+QH81_4+QH81_5+QH81_6+QH81_96+ QH83_1+QH83_2+QH83_3+QH83_4+QH83_5+QH83_6+QH83_7+QH83_96+ QH84_1+QH84_2+QH84_3+QH84_4+QH84_5+QH84_6+QH84_7+QH84_8+QH84_9+QH84_96+ QH85_1+QH85_2+QH85_3+QH85_4+QH85_5+QH85_6+ QH86_1+QH86_2+QH86_3+QH86_4+QH86_5+QH86_6+QH86_7+QH86_96+ DOMESTIC+LAND+HOUSE1+HOUSE2+JEWLERY+ANIMALS+memsleep )[S][Mean F8.3] by (ncombsco+nurbscor+nrurscor)[C] /slabels visible=no. * Alternative instead of ctables. *means tables= QH68A QH68B QH68C QH68D QH68E QH72_11 QH72_12 QH72_21 QH72_22 QH72_23 QH72_31 QH72_41 QH72_42 QH72_43 QH72_51 QH72_96 QH73_11 QH73_12 QH73_13 QH73_21 QH73_22 QH73_96 QH73_31 QH73_11_sh QH73_12_sh QH73_13_sh QH73_21_sh QH73_22_sh QH73_96_sh QH74 QH76_1 QH76_2 QH76_6 QH77 QH78_1 QH78_2 QH78_3 QH78_4 QH78_5 QH78_6 QH78_88 QH78_96 QH79A QH79B QH79C QH79D QH79E QH79F QH79G QH79H QH79I QH79J QH79K QH79L QH80 QH81_1 QH81_2 QH81_3 QH81_4 QH81_5 QH81_6 QH81_96 QH83_1 QH83_2 QH83_3 QH83_4 QH83_5 QH83_6 QH83_7 QH83_96 QH84_1 QH84_2 QH84_3 QH84_4 QH84_5 QH84_6 QH84_7 QH84_8 QH84_9 QH84_96 QH85_1 QH85_2 QH85_3 QH85_4 QH85_5 QH85_6 QH86_1 QH86_2 QH86_3 QH86_4 QH86_5 QH86_6 QH86_7 QH86_96 DOMESTIC LAND HOUSE1 HOUSE2 JEWLERY ANIMALS memsleep by ncombsco nurbscor nrurscor /cells mean count stddev. graph /histogram(normal)=combscor /title= 'Distribution of Households by Wealth Scores'. frequencies variables=combscor /format=notable /ntiles=5 /statistics=stddev minimum maximum semean mean median mode skewness seskew kurtosis sekurt /order=analysis. weight off. filter off. write formats combscor urbscore rurscore (f11.5). * Save final dataset of assets. save outfile='assets.sav'. *** Write out scores file. write outfile='COScores.dat' table /QHSEGMEN QHHOGAR combscor ncombsco urbscore nurbscor rurscore nrurscor. execute.